function sortFun (arr){
    var len = arr.length;
    for(var i = 0;i<len;i++){
        for ( var j = i; j <len ; j++) {
            if (arr[i] > arr[j] ) {
                var temp = arr[i];
                arr[i] = arr[j];
                arr[j] = temp;
            }
        }
    }
    return arr
}
console.log(sortFun ( [340,1,31,987,45,60]))
